#ifndef __GETS_PASSWD__
#define __GETS_PASSWD__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <shadow.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "train.h"
#define AUTH_REQUEST 9
#define AUTH_SUCCESS 100
#define AUTH_FAIL    101
// 检查返回值是否是错误标记,若是则打印msg和错误信息
#define ERROR_CHECK(ret, error_flag, msg) \
    do { \
        if ((ret) == (error_flag)) { \
            perror(msg); \
            exit(1); \
        } \
    } while (0)
#define ERROR_THREAD(ret,success_flag)\
    do { \
        if ((ret) != (success_flag)) { \
            fprintf(stderr,"pthread_create:%s\n",strerror(ret)); \
            exit(1); \
        } \
    } while (0)
int split_string(const char *input, char **front, char **back);
char* extract_password_prefix(const char* encrypted_password);
int check_password(const char *username_and_passwd, char **username_out);
int gate(int netfd, char **username_out);
#endif
